Support using global Plus Codes to represent location#68
Open
caleb-allen wants to merge 4 commits intoobsidianmd:masterfrom
Open
Support using global Plus Codes to represent location#68caleb-allen wants to merge 4 commits intoobsidianmd:masterfrom
caleb-allen wants to merge 4 commits intoobsidianmd:masterfrom
Conversation
Partially completes obsidianmd#16 This changes the handling of location strings by checking whether they are plus codes before processing them as lat/lon pairs. It also adds `open-location-code` as a dependency. ## Overview of Plus Codes Plus Codes are a way to represent geographical areas by using a string of characters and offer a system for addressing that is more human friendly than raw latitude and longitude coordinates. For example, the plus code **9C3XGVJC+2W** describes the location of [the British Library](https://plus.codes/9C3XGVJC+2W) in London. Compare this to the latitude and longitude values 51.530002, -0.127709, here written as Decimal Degrees, one of the many ways in which latitude and longitude are used. | Notation | Example (British Library) | Comment | | ----------------------------- | --------------------------------------------------------------------------------------------- | --------------------------------------------- | | Decimal Degrees (DD) | 51.530002, -0.127709<br>*OR*<br>51.530002°, -0.127709°<br>*OR*<br>51.530002 N, 0.127709 W<br> | GIS | | Degrees Minutes Seconds (DMS) | 51°31′48.01″N, 00°07′39.75″W<br>*OR*<br>51°31′48″N, 00°07′40″W | Navigation and cartography | | Degrees Decimal Minutes (DDM) | 51° 31.8' N, 12° 46.254' W | Electronic navigation (aviation and maritime) | | ISO 6709 | +51.530002-000.127709/ | Can include altitude | | Well-Known Text (WKT) | POINT(-0.127709 51.530002) | Written with longitude first! | A plus code **does** encode location coordinates, but in a way that is unambiguous, culturally independent, and easy to decode. It also represents an **area** rather than a single point. This allows **flexible precision**: the first four digits describe a 1° lat by 1° lon area, and each subsequent digit reduces the area further and further. A 10 digit code describes an area approximately 14m x 14m, and adding 5 more digits describes an area of **4 x 14mm**. #### See also - [Open Location Code specification](https://github.com/google/open-location-code/blob/main/Documentation/Specification/olc_definition.adoc) - [plus.codes](https://plus.codes/) demo
Author
|
For clarity, this probably needs some testing before being merged |
Author
Replace separate generate_plus_code_files function with a unified generate_test_files that accepts a pluscode_count argument (default 20), outputting both coordinate and Plus Code files to the same directory. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Partially completes #16
This changes the handling of location strings by checking whether they are plus codes before processing them as lat/lon pairs. It also adds
open-location-codeas a dependency.Overview of Plus Codes
Plus Codes are a way to represent geographical areas by using a string of characters and offer a system for addressing that is more human friendly than raw latitude and longitude coordinates.
For example, the plus code 9C3XGVJC+2W describes the location of the British Library in London. Compare this to the latitude and longitude values 51.530002, -0.127709, here written as Decimal Degrees, one of the many ways in which latitude and longitude are used.
OR
51.530002°, -0.127709°
OR
51.530002 N, 0.127709 W
OR
51°31′48″N, 00°07′40″W
A plus code does encode location coordinates, but in a way that is unambiguous, culturally independent, and easy to decode. It also represents an area rather than a single point. This allows flexible precision: the first four digits describe a 1° lat by 1° lon area, and each subsequent digit reduces the area further and further. A 10 digit code describes an area approximately 14m x 14m, and adding 5 more digits describes an area of 4 x 14mm.
See also